﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Sharp3DMath.Strokes;
using Sharp3DMath.Core;
using AI.Fuzzy.Library;
using System.Resources;

namespace Demo
{
    public partial class Form1 : Form
    {
        
       
        public Form1()
        {
            InitializeComponent();
          
        }


        private void ShowRecogniseResult(List<RuleResult> results)
        {
            //sort by the value
            results.Sort(delegate(RuleResult first, RuleResult second) { return second.Value.CompareTo(first.Value); });
           
            foreach (var item in results)
            {
               // System.Diagnostics.Debug.WriteLine(item.FuzzyVariableName);
                System.Diagnostics.Debug.WriteLine(item.FuzzyTermName);
            }
            ResourceManager RM = new ResourceManager(GetType());
            this.pictureBox1.Image = (System.Drawing.Bitmap)RM.GetObject(results[0].FuzzyTermName);
            this.pictureBox2.Image = (System.Drawing.Bitmap)RM.GetObject(results[1].FuzzyTermName);
            this.pictureBox3.Image = (System.Drawing.Bitmap)RM.GetObject(results[2].FuzzyTermName);

            this.label1.Text = results[0].FuzzyTermName + ":" + Math.Round(results[0].Value, 3, MidpointRounding.ToEven).ToString();
            this.label2.Text = results[1].FuzzyTermName + ":" + Math.Round(results[1].Value, 3, MidpointRounding.ToEven).ToString();
            this.label3.Text = results[2].FuzzyTermName + ":" + Math.Round(results[2].Value, 3, MidpointRounding.ToEven).ToString();
            //pictureBoxs[.Image = (System.Drawing.Bitmap)RM.GetObject(sharpResult[i].sharpName);
        }
        private void paintControl1_SketchRecogniseFinished(object sender, SketchRecogniseFinishedEventArgs e)
        {
            ShowRecogniseResult(e.RecogniseResults);
        }
    }
}
